package cn.uexpo.lhz.common.oldBase;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import cn.uexpo.lhz.common.oldUtils.PageRequest;
import cn.uexpo.lhz.common.oldUtils.PageResult;


/**
 *
 * @ClassName:  BaseBiz
 * @Description:TODO(通用CURD接口)
 * @author: 李冬建
 * @date:   2020年4月30日 上午9:39:59
 * @param <T>
 * @param <T1>
 * @Copyright:  1.0.0
 */
public interface BaseBiz<T, T1> {



	/**
	 *
	 * @Title: insert
	 * @Description: TODO(添加)
	 * @param: @param record
	 * @param: @return
	 * @param: @throws BOException
	 * @return: int
	 * @throws
	 */
	int insert(T record) throws  BOException;//所有字段都插入，空的为null

	int insertSelective(T record) throws  BOException;//只插入不为null的字段

	/**
	 *
	 * @Title: deleteByPrimaryKey
	 * @Description: TODO(单条删除)
	 * @param: @param id
	 * @param: @return
	 * @param: @throws BOException
	 * @return: int
	 * @throws
	 */
	int deleteByPrimaryKey(Integer id) throws  BOException;//根据id删除

	int deleteEntity(T record) throws  BOException;//删除实体类


	/**
	 *
	 * @Title: deleteByIds
	 * @Description: TODO(批量/多条 删除)
	 * @param: @param ids
	 * @param: @return
	 * @param: @throws BOException
	 * @return: int
	 * @throws
	 */
	int deleteByIds(List<Integer> ids) throws  BOException;

	int delete(List<T> records) throws  BOException;

	int deleteByExample(T1 example) throws  BOException;//根据条件删除

	/**
	 *
	 * @Title: updateByPrimaryKey
	 * @Description: TODO(修改)
	 * @param: @param record
	 * @param: @return
	 * @param: @throws BOException
	 * @return: int
	 * @throws
	 */
	int updateByPrimaryKey(T record) throws  BOException;//对注入的字段全部更新

	int updateByPrimaryKeySelective(T record) throws  BOException;//对字段进行判断再更新(如果为Null就忽略更新),如果只想更新某一字段，可以用这个方法。

	int updateByExampleSelective(@Param("record") T record, @Param("example") T1 example) throws  BOException;

	int updateByExample(@Param("record") T record, @Param("example") T1 example) throws  BOException;


	/**
	 *
	 * @Title: selectByPrimaryKey
	 * @Description: TODO(查询)
	 * @param: @param id
	 * @param: @return
	 * @param: @throws BOException
	 * @return: T
	 * @throws
	 */
	T selectByPrimaryKey(Integer id) throws  BOException;//根据ID查询

	T selectByUniqueCode(String uniqueCode) throws BOException;//根据唯一编码查询，定义为字符串类型

	List<T> selectByExample(T1 example) throws  BOException;//条件查询


	/**
	 *
	 * @Title: countByExample
	 * @Description: TODO(查询数量)
	 * @param: @param example
	 * @param: @return
	 * @param: @throws BOException
	 * @return: long
	 * @throws
	 */
	long countByExample(T1 example) throws  BOException;



	/**
	 *
	 * @Title: findPage
	 * @Description: TODO(分页查询)
	 * @param: @param pageRequest
	 * @param: @param example
	 * @param: @return
	 * @param: @throws BOException
	 * @return: PageResult
	 * @throws
	 */
	PageResult findPage(PageRequest pageRequest, T1 example) throws  BOException;





}
